let arr = [10, 20, 30, 40, 50]
const newArr = arr.splice(arr.length - 1)
console.log(arr)
console.log(newArr)